package com.nasarius.bank.scorecard.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.nasarius.bank.scorecard.dao.BankDetailsDAO;
import com.nasarius.bank.scorecard.domain.BankDetails;
import com.nasarius.bank.scorecard.domain.BankDetailsExample;
@Repository

public class BankDetailsDAOImpl extends SqlMapClientDaoSupport implements BankDetailsDAO {
	
	

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
	@Autowired
    public BankDetailsDAOImpl(/*@Qualifier("sqlMapClient")*/SqlMapClient sqlMapClient) {
        super();
        setSqlMapClient(sqlMapClient);
    }
    
    
    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int countBankDetailsByExample(BankDetailsExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("bank_details.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int deleteBankDetailsByExample(BankDetailsExample example) {
        int rows = getSqlMapClientTemplate().delete("bank_details.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int deleteBankDetailsByPrimaryKey(String bankcode) {
        BankDetails key = new BankDetails();
        key.setBankcode(bankcode);
        int rows = getSqlMapClientTemplate().delete("bank_details.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public void insertBankDetails(BankDetails record) {
        getSqlMapClientTemplate().insert("bank_details.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public void insertBankDetailsSelective(BankDetails record) {
        getSqlMapClientTemplate().insert("bank_details.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    @SuppressWarnings("unchecked")
    public List<BankDetails> selectBankDetailsByExample(BankDetailsExample example) {
        List<BankDetails> list = getSqlMapClientTemplate().queryForList("bank_details.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public BankDetails selectBankDetailsByPrimaryKey(String bankcode) {
        BankDetails key = new BankDetails();
        key.setBankcode(bankcode);
        BankDetails record = (BankDetails) getSqlMapClientTemplate().queryForObject("bank_details.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int updateBankDetailsByExampleSelective(BankDetails record, BankDetailsExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("bank_details.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int updateBankDetailsByExample(BankDetails record, BankDetailsExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("bank_details.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int updateBankDetailsByPrimaryKeySelective(BankDetails record) {
        int rows = getSqlMapClientTemplate().update("bank_details.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int updateBankDetailsByPrimaryKey(BankDetails record) {
        int rows = getSqlMapClientTemplate().update("bank_details.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table bank_details
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    private static class UpdateByExampleParms extends BankDetailsExample {
        private Object record;

        public UpdateByExampleParms(Object record, BankDetailsExample example) {
            super(example);
            this.record = record;
        }

        @SuppressWarnings("unused")
		public Object getRecord() {
            return record;
        }
    }
    @SuppressWarnings("unchecked")
	public List<BankDetails> selectAllBankDetails() {
		 List<BankDetails> list = getSqlMapClientTemplate().queryForList("bank_details.ibatorgenerated_selectAll");
	        return list;
	}


	@SuppressWarnings("unchecked")
	@Override
	public List<BankDetails> selectAllActiveBankDetails() {
		List<BankDetails> list = getSqlMapClientTemplate().queryForList("bank_details.selectAllActive");
        return list;	
    }
	@SuppressWarnings("unchecked")
	public List<BankDetails> selectAllAuthorizedBankDetails(String userName) {
		List<BankDetails> list = getSqlMapClientTemplate().queryForList("bank_details.selectAllAuthorized", userName);
        return list;	
    }
}